﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace canyinguanlixitong
{
    public partial class frmyinyeqw2 : Form
    {
        public frmyinyeqw2()
        {
            InitializeComponent();
        }

        private void frmyinyeqw2_Load(object sender, EventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            add();
        }
        string str = "Data Source=.;Initial Catalog=Supermarket management system;Integrated Security=True";
        public void add() {
            SqlConnection conn = new SqlConnection(str);
            DataSet ds = new DataSet("Student");
            string sql = "select * from dbo.tuidan where id like'%"+this.txtname.Text+"%'";
            SqlDataAdapter asd = new SqlDataAdapter(sql,conn);
            asd.Fill(ds,"Student");
            dataGridView1.DataSource = ds.Tables["Student"];
        }
    }
}
